'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: base_agent.py
* @Time: 2025/11/17
* @All Rights Reserve By Brtc
'''
from abc import ABC, abstractmethod
from typing import Generator

from langchain_core.messages import AnyMessage

from internal.core.agent.agents.agent_queue_manager import AgentQueueManager
from internal.entity.agent_entity import AgentConfig
from internal.entity.queue_entity import  AgentQueueEvent


class BaseAgent(ABC):
    """LLMops 项目基础"""
    agent_config:AgentConfig
    agent_queue_manager:AgentQueueManager

    def __init__(self, agent_config:AgentConfig, agent_queue_manager:AgentQueueManager):
        """构造函数"""
        self.agent_config = agent_config
        self.agent_queue_manager = agent_queue_manager

    @abstractmethod
    def run(self,
            query:str,
            history:list[AnyMessage] = None,
            long_term_memory:str = "")->Generator[AgentQueueEvent, None, None]:
        """智能体运行函数，传递原始问题query、长短期记忆、并调用智能体生成相应的内容"""
        raise NotImplementedError("Agent 智能体基类run函数必须要自己实现！！！")